home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / New System Software Extensions / OpenDoc A6 / OpenDoc Parts Framework / OPF / OS / FWGraphx / Sources / FWBndShp.cpp < prev    next >
Encoding:
Text File  |  1994-04-21  |  4.6 KB  |  153 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWBndShp.cpp
  4. //    Release Version:    $ 1.0d1 $
  5. //
  6. //    Creation Date:        3/28/94
  7. //
  8. //    Copyright:    © 1993, 1994 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #ifndef FWBNDSHP_H
  13. #include "FWBndShp.h"
  14. #endif
  15.  
  16. #ifndef FWSHAPE_H
  17. #include "FWShape.h"
  18. #endif
  19.  
  20. #ifndef FWGC_H
  21. #include "FWGC.h"
  22. #endif
  23.  
  24. #ifndef FWDFAULT_H
  25. #include "FWDFault.h"
  26. #endif
  27.  
  28. // ----- OpenDoc Includes -----
  29.  
  30. #ifndef _TRNSFORM_
  31. #include <Trnsform.h>
  32. #endif
  33.  
  34. //==============================================================================
  35. //    •• RunTime Info
  36. //==============================================================================
  37.  
  38. #ifdef FW_BUILD_MAC
  39. #pragma segment fwgraphx
  40. #endif
  41.  
  42. //==============================================================================
  43. //    •• class FW_CBoundedShapeRep
  44. //==============================================================================
  45.  
  46. //------------------------------------------------------------------------------
  47. //    • FW_CBoundedShapeRep::FW_CBoundedShapeRep
  48. //------------------------------------------------------------------------------
  49.  
  50. FW_CBoundedShapeRep::FW_CBoundedShapeRep() :
  51.     fRect(0, 0, 0, 0)
  52. {
  53. }
  54.  
  55. //------------------------------------------------------------------------------
  56. //    • FW_CBoundedShapeRep::FW_CBoundedShapeRep
  57. //------------------------------------------------------------------------------
  58.  
  59. FW_CBoundedShapeRep::FW_CBoundedShapeRep(const FW_SDefaultProperties& defaultProperties,
  60.                                          const FW_CRect& rect) :
  61.     FW_CShapeRep(defaultProperties),
  62.     fRect(rect)
  63. {
  64. }
  65.  
  66. //------------------------------------------------------------------------------
  67. //    • FW_CBoundedShapeRep::~FW_CBoundedShapeRep
  68. //------------------------------------------------------------------------------
  69.  
  70. FW_CBoundedShapeRep::~FW_CBoundedShapeRep()
  71. {
  72. }
  73.  
  74. //------------------------------------------------------------------------------
  75. //    • FW_CBoundedShapeRep::Transform
  76. //------------------------------------------------------------------------------
  77.  
  78. void FW_CBoundedShapeRep::Transform(XMPTransform* transform)
  79. {
  80.     fRect[FW_kTopLeft] = transform->TransformPoint(fRect[FW_kTopLeft]);
  81.     fRect[FW_kBotRight] = transform->TransformPoint(fRect[FW_kBotRight]);
  82. }
  83.  
  84. //------------------------------------------------------------------------------
  85. //    • FW_CBoundedShapeRep::GetShapeBounds
  86. //------------------------------------------------------------------------------
  87.  
  88. FW_CRect FW_CBoundedShapeRep::GetShapeBounds() const
  89. {
  90.     return fRect;
  91. }
  92.  
  93. //------------------------------------------------------------------------------
  94. //    • FW_CBoundedShapeRep::InverseTransform
  95. //------------------------------------------------------------------------------
  96.  
  97. void FW_CBoundedShapeRep::InverseTransform(XMPTransform* transform)
  98. {
  99.     fRect[FW_kTopLeft] = transform->InvertPoint(fRect[FW_kTopLeft]);
  100.     fRect[FW_kBotRight] = transform->InvertPoint(fRect[FW_kBotRight]);
  101. }
  102.  
  103. //------------------------------------------------------------------------------
  104. //    • FW_CBoundedShapeRep::MoveShape
  105. //------------------------------------------------------------------------------
  106.  
  107. void FW_CBoundedShapeRep::MoveShape(XMPCoordinate deltaX, XMPCoordinate deltaY)
  108. {
  109.     fRect.left += deltaX;
  110.     fRect.top += deltaY;
  111.     fRect.right += deltaX;
  112.     fRect.bottom += deltaY;
  113. }
  114.  
  115. //------------------------------------------------------------------------------
  116. //    • FW_CBoundedShapeRep::MoveShapeTo
  117. //------------------------------------------------------------------------------
  118.  
  119. void FW_CBoundedShapeRep::MoveShapeTo(XMPCoordinate x, XMPCoordinate y)
  120. {
  121.     fRect.right += x - fRect.left;
  122.     fRect.bottom += y - fRect.top;
  123.     fRect.left = x;
  124.     fRect.top = y;
  125. }
  126.  
  127. //------------------------------------------------------------------------------
  128. //    • FW_CBoundedShapeRep::HitTest
  129. //------------------------------------------------------------------------------
  130.  
  131. FW_HitTestPart FW_CBoundedShapeRep::HitTest(const FW_CPoint& test) const
  132. {
  133.     return FW_kOutside;
  134. }
  135.  
  136. //----------------------------------------------------------------------------------------
  137. //    • FW_CBoundedShapeRep::Flatten
  138. //----------------------------------------------------------------------------------------
  139.  
  140. void FW_CBoundedShapeRep::Flatten(FW_CWritableStream& stream)
  141. {
  142.     fRect.Flatten(stream);
  143. }
  144.  
  145. //----------------------------------------------------------------------------------------
  146. //    • FW_CBoundedShapeRep::Unflatten
  147. //----------------------------------------------------------------------------------------
  148.  
  149. void FW_CBoundedShapeRep::Unflatten(FW_CReadableStream& stream)
  150. {
  151.     fRect.Unflatten(stream);
  152. }
  153.